]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
unlockDialog: Handle embedded newlines in notifications
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 22 Mar 2020 20:14:34 +0000 (21:14 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 22 Mar 2020 20:19:36 +0000 (21:19 +0100)
Detailed notifications are meant to be single line, just as unexpanded
notification banners. So handle them the same way as in the message
list, and replace embedded newlines by spaces.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2463

js/ui/unlockDialog.js

index 33635fdd03d0e181c442837bfd341cc10c876c0d..d27b1d59caacd75cea392bb7ab3485d786137f2b 100644 (file)
@@ -115,7 +115,7 @@ var NotificationsBox = GObject.registerClass({
         box.add_child(textBox);
 
         let title = new St.Label({
-            text: source.title,
+            text: source.title.replace(/\n/g, ' '),
             style_class: 'unlock-dialog-notification-label',
         });
         textBox.add(title);
@@ -129,9 +129,10 @@ var NotificationsBox = GObject.registerClass({
 
             let body = '';
             if (n.bannerBodyText) {
+                const bodyText = n.bannerBodyText.replace(/\n/g, ' ');
                 body = n.bannerBodyMarkup
-                    ? n.bannerBodyText
-                    : GLib.markup_escape_text(n.bannerBodyText, -1);
+                    ? bodyText
+                    : GLib.markup_escape_text(bodyText, -1);
             }
 
             let label = new St.Label({ style_class: 'unlock-dialog-notification-count-text' });